Implement caching among fingerprint resolutions
authorAlex Crichton <alex@alexcrichton.com>
Fri, 29 May 2015 18:22:44 +0000 (11:22 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 3 Jun 2015 01:05:47 +0000 (18:05 -0700)
commit77622892697e5ff8b978b1496d51416c7bfafee2
treef0e3903ab356ba486a4813cb22baf688bfc07431
parent34a52a4468c129edf98b2af1ebca0a2dab927e64
Implement caching among fingerprint resolutions

This commit adds support for caching the resolved value of a fingerprint among
calls to `resolve`. Due to the recursive nature of a fingerprint, it means that
`resolve` is currently executed a very large number of times for packages which
at transitively dependend up on many times. By caching the returned value of a
fingerprint we're able to prevent extraneous calls into the filesystem or
extraneous hashing.

This also adds an `Arc` to share a `Fingerprint` among all its dependencies as
each fingerprint stores a list of fingerprints that it depends on, and if
they're not shared then the cache isn't exactly the most helpful!

For a noop `cargo build` on Servo (e.g. everything was already built), this
decreased Cargo's runtime from 5s to ~4.5s
src/cargo/ops/cargo_rustc/fingerprint.rs